import newsList from "@/views/newsList.vue";
import newsManage from "@/views/newsManage.vue";
import userCenter from "@/views/userCenter.vue";
import usersManage from "@/views/usersManage.vue";
import userLogin from "@/views/userLogin.vue";
import userRegister from "@/views/userRegister.vue";
import userInformationDialog from "@/views/userInformationDialog.vue";
import newsTypes from "@/views/newsTypes.vue";
import commentManage from "@/views/commentManage.vue";
import addNews from "@/views/addNews.vue";
import userChildren from "@/views/userChildren.vue";
import userProfile from "@/views/userProfile.vue";
import newsDetail from "@/views/newsDetail.vue"
import roleManage from "@/views/roleManage.vue"
//import user from "@/layout/UserLayout.vue";


const routes = [
  {
    path: '/userLogin',
    name: '用户登录',
    component: userLogin
  },
  {
    path: '/userRegister',
    name: '用户注册',
    component: userRegister
  },
  {
    path: '/',
    name: '新闻列表',
    props: true,
    component: newsList
  },
  {
    path: '/search',
    name: '新闻搜索',
    props: true,
    component: () => import('@/views/newSearch.vue'),
  },
  {
    path: '/newsManage',
    name: '新闻管理',
    component: newsManage,
    meta: {
      access: 'admin'
    }
  },
  {
    path: '/userCenter',
    name: '用户中心',
    component: userCenter,
    children: [
      {
        path: '/userChildren',
        component: userChildren,
      },
      {
        path: '/userProfile',
        component: userProfile,
      }
    ]
  },
  {
    path: '/usersManage',
    name: '用户管理',
    component: usersManage,
    meta: {
      access: 'admin'
    }
  },
  {
    path: '/roleManage',
    name: '角色管理',
    component: roleManage
  },
  {
    path: '/userInformationDialog',
    name: '用户信息修改对话框',
    component: userInformationDialog
  },
  {
    path: '/newsTypes',
    name: '新闻类型',
    component: newsTypes,
    meta: {
      access: 'admin'
    }
  },
  {
    path: '/commentManage',
    name: '评论管理',
    component: commentManage,
    meta: {
      access: 'admin'
    }
  },
  {
    path: '/addNews',
    name: '新闻发布',
    component: addNews
  },
  {
    path: '/newsDetail/:id',
    name: '新闻详情',
    props: true,
    component: newsDetail,
  }

];

export default routes;